﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wwtfly.BBS.BackModels.Models.ExpertNews;
using Wwtfly.Utility;
using Wwtfly.BBS.BackModels.Models.Users;
using Wwtfly.BBS.BackBLL.ExpertNews;
using Wwtfly.BBS.BackModels.Models.NewsType;
using Wwtfly.BBS.BackBLL.News;

namespace Wwtfly.BBS.ForeApplication.WebForm
{
    public partial class LookExpertNews : System.Web.UI.Page
    {
        protected static NewsTypesModel newType9 = null;
        protected ExpertNewsShowsModel expertNews = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                newType9 = NewTypesBLL.GetInfo(9);
                if (newType9 != null)
                {
                    this.Repeaternew1.DataSource = NewsBLL.NewsList(10, NewTypesBLL.GetInfo(newType9.Id).Id);
                    this.Repeaternew1.DataBind();
                }
                if (Session[LoginUserUtil.LOGIN_USER] != null)
                {
                    UsersModel usermd = Session[LoginUserUtil.LOGIN_USER] as UsersModel;
                    int expertId = 0;
                    try
                    {
                        string epertion = Request.QueryString["expertaction"];
                        expertId = epertion.AsInt(0);
                    }
                    catch (Exception ex)
                    {
                        expertId = 0;
                        ex = null;
                    }

                    if (expertId != 0)
                    {
                        int sult;
                        expertNews = ExpertNewsBLL.GetInfoshows(usermd.Id, expertId,out sult);
                        if (expertNews == null)
                        {
                            if (sult == -2)
                            {
                                Response.Write("<script> alert('用户彩币不足，请及时充值!');</script>");
                            }
                            else
                            {
                                Response.Write("<script> alert('系统繁忙。。。请重新登录!');</script>");
                            }
                        }

                    }
                 
                }
              
            }
        }
    }
}